package gdepot
/*
 * 存放用户和银行卡的关系+验卡结果
 */
class AccountBank {

    String status                // 验卡结果
    Boolean isPrimary = true    // 是否为主卡
    String bankCardNo      // 银行卡号
    String fullName        //银行卡户名
    String cellphone            // 银行预留手机号
    String certificateType      //证件类型
    String idCard  //身份证号
    Date createdDate = new Date()   //创建日期
    Date modifiedDate = new Date()  //修改日期

    static belongsTo = [account:User, bank: Bank]
    static constraints = {
        cellphone matches: /\d{11}/,nullable: true
//        certificateType inList: ['0','1','2','3','5','7'],nullable: true
        certificateType inList: ['身份证','护照','军官证','士兵证','回乡证','户口本','外国护照','其他'],nullable: true
        idCard maxSize: 20,nullable: true
        status inList:['SUCCESS','FAILED']  //验卡结果
        isPrimary nullable: true
        bankCardNo maxSize: 20
        fullName size: 2..20
        createdDate nullable: true, blank: true
        modifiedDate nullable: true, blank: true
    }

   def  beforeUpdate(){
       modifiedDate = new Date()
    }
}
